<template>
  <div class="template-wrap">
    <menu-top></menu-top>
    <div class="content">
      <div class="content-wrap">
        <div>
          <menu-left ref="left" :href="href"></menu-left>
        </div>
        <el-col class="main-content">
          <div class="breadcrumb-wrapper">
            <el-breadcrumb separator-class="el-icon-arrow-right">
              <el-breadcrumb-item >我的公司</el-breadcrumb-item>
              <el-breadcrumb-item>财务信息</el-breadcrumb-item>
            </el-breadcrumb>
          </div>
          <rotate-message></rotate-message>
          <div>
            <div class="operate-edit">
                <div class="balance-head">
                    <div class="balance-title">新增现金流量表</div>
                    <div class="balance-search">
                        <div class="balance-item">
                            报表时间：
                           <el-date-picker
                            v-model="information.rptDate"
                            type="month"
                            format="yyyy 年 MM 月"
                            value-format="yyyy-MM"
                            placeholder="选择报表时间">
                            </el-date-picker>
                            <div v-show="errorState" class="error-tip">请选择报表时间</div>
                        </div>
                        <div class="balance-item">
                            报表主体：
                           <el-select v-model="information.associationId" filterable>
                                <el-option
                                label="主体公司"
                                :value="0"></el-option>
                                <el-option
                                v-for="item in companyArr"
                                :key="item.id"
                                :label="item.associatedCompanyName"
                                :value="item.id">
                                </el-option>
                            </el-select>
                            <!-- <div v-show="errorState1" class="error-tip">请输入报表主体</div> -->
                        </div>
                        <div class="balance-item">
                            报表是否审计：
                           <el-select  v-model="information.isCheck">
                                <el-option label="是" value="y"></el-option>
                                <el-option label="否" value="n"></el-option>
                            </el-select>
                            <div v-show="errorState2" class="error-tip">请选择报表是否审计</div>
                        </div>
                        <div class="balance-item">
                            报表币种：
                           <el-select  v-model="information.currency">
                               <el-option
                                v-for="item in giveArr"
                                :key="item.key"
                                :label="item.value"
                                :value="item.key">
                                </el-option>
                            </el-select>
                             <div v-show="errorState3" class="error-tip">请选择报表币种</div>
                        </div>
                        <div class="balance-item">
                            报表附件：
                           <el-upload
                            class="upload-demo"
                            :action="upLoadUrl"
                            :on-remove="handleRemove"
                            :show-file-list="false"
                            :on-success="handleFileSuccess">
                                <div class="btn">上传</div>
                            </el-upload>
                            <div class="file-name"><a style="color:#F8B100" :href="information.attachmentFile?information.attachmentFile.fileUrl:''">{{fileName}}</a></div>
                        </div>
                    </div>
                </div>
                <div class="balance-wrap">
                     <el-form :model="information" :rules="rules" ref="information" >
                        <div class="balance-line">
                            <el-form-item prop="cashRecpSgAndRs">
                                <div class="balance-item">
                                    <span>销售商品、提供劳务收到的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.cashRecpSgAndRs" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="recpTaxRends">
                                <div class="balance-item">
                                    <span>收到的税费返还：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.recpTaxRends" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="otherCashRecpRalOperAct">
                                <div class="balance-item">
                                    <span>收到其他与经营活动有关的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.otherCashRecpRalOperAct" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item>
                                <div class="balance-item balance-title">
                                    <span>经营活动现金流入小计：</span> 
                                    <div  class="tip">{{totalNum?formateMoney(totalNum)+'元':0}}</div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="casPayGoodsPurchServRec">
                                <div class="balance-item">
                                    <span>购买商品、接受劳务支付的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.casPayGoodsPurchServRec" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="cashPayBehEmpl">
                                <div class="balance-item">
                                    <span>支付给职工以及为职工支付的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.cashPayBehEmpl" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="payAllTypTax">
                                <div class="balance-item">
                                    <span>支付的各项税费：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.payAllTypTax" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="otherCashPayRalOperAct">
                                <div class="balance-item">
                                    <span>支付其他与经营活动有关的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.otherCashPayRalOperAct" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item>
                                <div class="balance-item balance-title">
                                    <span>经营活动现金流出小计：</span> 
                                    <div  class="tip">{{totalNum1?formateMoney(totalNum1)+'元':0}}</div>
                                </div>
                            </el-form-item>
                            <el-form-item>
                                <div class="balance-item balance-title">
                                    <span>经营活动产生的现金流量净额：</span> 
                                    <div  class="tip">{{totalNum2?formateMoney(totalNum2)+'元':0}}</div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="cashRecpDispWithdrwlInvest">
                                <div class="balance-item">
                                    <span>收回投资收到的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.cashRecpDispWithdrwlInvest" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="cashRecpReturnInvest">
                                <div class="balance-item">
                                    <span>取得投资收益收到的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.cashRecpReturnInvest" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="netCashRecpDispFiolta">
                                <div class="balance-item">
                                    <span>处置固定资产、无形资产和其他长期资产收回的现金净额：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.netCashRecpDispFiolta" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="netCashRecpDispSobu">
                                <div class="balance-item">
                                    <span>处置子公司及其他营业单位收到的现金净额：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.netCashRecpDispSobu" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="otherCashRecpRalInvAct">
                                <div class="balance-item">
                                    <span>收到其他与投资活动有关的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.otherCashRecpRalInvAct" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item>
                                <div class="balance-item balance-title">
                                    <span>投资活动现金流入小计：</span> 
                                    <div  class="tip">{{totalNum3?formateMoney(totalNum3)+'元':0}}</div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="cashPayAcqConstFiolta">
                                <div class="balance-item">
                                    <span>构建固定资产、无形资产和其他长期资产支付的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.cashPayAcqConstFiolta" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="cashPaidInvest">
                                <div class="balance-item">
                                    <span>投资支付的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.cashPaidInvest" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="netCashPayAquisSobu">
                                <div class="balance-item">
                                    <span>取得子公司及其他营业单位支付的现金净额：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.netCashPayAquisSobu" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="otherCashPayRalInvAct">
                                <div class="balance-item">
                                    <span>支付其他与投资活动有关的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.otherCashPayRalInvAct" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item>
                                <div class="balance-item balance-title">
                                    <span>投资活动现金流出小计</span> 
                                    <div  class="tip">{{totalNum4?formateMoney(totalNum4)+'元':0}}</div>
                                </div>
                            </el-form-item>
                            <el-form-item>
                                <div class="balance-item balance-title">
                                    <span>投资活动产生的现金流量净额</span> 
                                    <div  class="tip">{{totalNum5?formateMoney(totalNum5)+'元':0}}</div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="cashRecpCapContrib">
                                <div class="balance-item">
                                    <span>吸收投资收到的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.cashRecpCapContrib" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="cashRecpBorrow">
                                <div class="balance-item">
                                    <span>取得借款收到的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.cashRecpBorrow" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="procIssueBonds">
                                <div class="balance-item">
                                    <span>发行债券收到的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.procIssueBonds" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="otherCashRecpRalFncAct">
                                <div class="balance-item">
                                    <span>收到其他与筹资活动有关的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.otherCashRecpRalFncAct" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item>
                                <div class="balance-item balance-title">
                                    <span>筹资活动现金流入小计：</span> 
                                    <div  class="tip">{{totalNum6?formateMoney(totalNum6)+'元':0}}</div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="cashPrepayAmtBorr">
                                <div class="balance-item">
                                    <span>偿还债务支付的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.cashPrepayAmtBorr" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="cashPayDistDpcpIntExp">
                                <div class="balance-item">
                                    <span>分配股利、利润和偿付利息所支付的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.cashPayDistDpcpIntExp" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="otherCashPayRalFncAct">
                                <div class="balance-item">
                                    <span>支付其他与筹资活动有关的现金：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.otherCashPayRalFncAct" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item>
                                <div class="balance-item balance-title">
                                    <span>筹资活动现金流出小计：</span> 
                                    <div  class="tip">{{totalNum7?formateMoney(totalNum7)+'元':0}}</div>
                                </div>
                            </el-form-item>
                            <el-form-item>
                                <div class="balance-item balance-title">
                                    <span>筹资活动产生的现金流量净额：</span> 
                                    <div  class="tip">{{totalNum8?formateMoney(totalNum8)+'元':0}}</div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="feeFxFluCash">
                                <div class="balance-item">
                                    <span>汇率变动对现金及现金等价物的影响：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.feeFxFluCash" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item>
                                <div class="balance-item balance-title">
                                    <span>现金及现金等价物净增加额：</span> 
                                    <div  class="tip">{{totalNum9?formateMoney(totalNum9)+'元':0}}</div>
                                </div>
                            </el-form-item>
                            <el-form-item prop="cashCashEquBegPeriod">
                                <div class="balance-item">
                                    <span>加：期初现金及现金等价物余额：</span>
                                    <div  class="tip"><el-input type="number" v-model="information.cashCashEquBegPeriod" placeholder="请输入数字，单位元"></el-input></div>
                                </div>
                            </el-form-item>
                            <el-form-item>
                                <div class="balance-item balance-title">
                                    <span>期末现金及现金等价物余额：</span> 
                                    <div  class="tip">{{totalNum10?formateMoney(totalNum10)+'元':0}}</div>
                                </div>
                            </el-form-item>
                        </div>
                     </el-form>
                     <div class="btns-bottom">
                        <div @click="confrimBtn('information')" class="btn">保存</div>
                        <div @click="$router.push('financialCashflow')" class="btn-cancel">取消</div>
                     </div>
                </div>
            </div>
          </div>
        </el-col>
      </div>
    </div>
  </div>
</template>

<script>
let CONSTANT = require('../../../constant/constant.js'),
    common = require('../../../common.js');
    import { formateMoney } from '../../../common.js'
import VueRouter from 'vue-router'
export default {
  data() {
      var validateNum =  (rule, value, callback) => { 
        if (isNaN(value)){ return callback(new Error('请输入数字')); }
        // var reg= /^(-?\d+)(\.\d{1,2})?$/
        // if (!reg.test(value)){ return callback(new Error('请保留两位小数')); }
        callback();
    };
    return {
      href: '',
      active: 0,
      information:{
        'associationId':'',
        "attachmentId": "",
        "casPayGoodsPurchServRec":  "",
        "cashCashEquBegPeriod":  "",
        "cashPaidInvest": "",
        "cashPayAcqConstFiolta": "",
        "cashPayBehEmpl": "",
        "cashPayDistDpcpIntExp": "",
        "cashPrepayAmtBorr": "",
        "cashRecpBorrow":"",
        "cashRecpCapContrib":"",
        "cashRecpDispWithdrwlInvest": "",
        "cashRecpReturnInvest": "",
        "cashRecpSgAndRs":"",
        "currency":"",
        "feeFxFluCash": "",
        "financingInflowsCash": "",
        "financingNetFlows": "",
        "financingOutflowsCash": "",
        "id": "",
        "investInflowsCash": "",
        "investNetFlows": "",
        "investOutflowsCash":"",
        "isCheck": "",
        "netCashPayAquisSobu": "",
        "netCashRecpDispFiolta": "",
        "netCashRecpDispSobu": "",
        "netIncrCashCashEquDm": "",
        "otherCashPayRalFncAct": "",
        "otherCashPayRalInvAct":"",
        "otherCashPayRalOperAct": "",
        "otherCashRecpRalFncAct": "",
        "otherCashRecpRalInvAct":"",
        "otherCashRecpRalOperAct": "",
        "payAllTypTax":"",
        "procIssueBonds": "",
        "recpTaxRends":"",
        "rptDate": "",
        "rptMaster": "",
        "runInflowsCash":"",
        "runNetFlows":"",
        "runOutflowsCash": "",
        "userId":""
      },
      giveArr:[],
      upLoadUrl:'',
      fileName:'',
    rules:{ 
        // cashRecpSgAndRs :[
        //     // {{required: true, message: '请输入销售商品、提供劳务收到的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // recpTaxRends:[
        //   // {  {required: true, message: '请输入收到的税费返还', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // otherCashRecpRalOperAct:[
        //     // {{required: true, message: '请输入收到其他与经营活动有关的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // casPayGoodsPurchServRec:[
        //    // { {required: true, message: '请输入购买商品、接受劳务支付的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // cashPayBehEmpl :[
        //    // { {required: true, message: '请输入支付给职工以及为职工支付的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        //  payAllTypTax:[
        //     {required: true, message: '请输入支付的各项税费', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // otherCashPayRalOperAct:[
        //     {required: true, message: '请输入支付其他与经营活动有关的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // cashRecpDispWithdrwlInvest:[
        //    // { {required: true, message: '请输入收回投资收到的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // cashRecpReturnInvest:[
        //    // { {required: true, message: '请输入取得投资收益收到的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // netCashRecpDispFiolta:[
        //   // {  {required: true, message: '请输入处置固定资产、无形资产和其他长期资产收回的现金净额', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // netCashRecpDispSobu:[
        //     // {{required: true, message: '请输入处置子公司及其他营业单位收到的现金净额', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // otherCashRecpRalInvAct:[
        //     // {{required: true, message: '请输入收到其他与投资活动有关的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // cashPayAcqConstFiolta:[
        //     // {{required: true, message: '请输入构建固定资产、无形资产和其他长期资产支付的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // cashPaidInvest :[
        //    // { {required: true, message: '请输入投资支付的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // netCashPayAquisSobu :[
        //    // { {required: true, message: '请输入取得子公司及其他营业单位支付的现金净额', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // otherCashPayRalInvAct :[
        //     // {{required: true, message: '请输入支付其他与投资活动有关的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // cashRecpCapContrib:[
        //   // {  {required: true, message: '请输入吸收投资收到的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // cashRecpBorrow:[
        //     // {{required: true, message: '请输入取得借款收到的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // procIssueBonds:[
        //    // { {required: true, message: '请输入发行债券收到的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // otherCashRecpRalFncAct:[
        //    // { {required: true, message: '请输入收到其他与筹资活动有关的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // cashPrepayAmtBorr:[
        //    // { {required: true, message: '请输入偿还债务支付的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // cashPayDistDpcpIntExp:[
        //    // { {required: true, message: '请输入分配股利、利润和偿付利息所支付的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // otherCashPayRalFncAct:[
        //     // {{required: true, message: '请输入支付其他与筹资活动有关的现金', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // feeFxFluCash:[
        //     // {{required: true, message: '请输入汇率变动对现金及现金等价物的影响', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
        // cashCashEquBegPeriod :[
        //     // {required: true, message: '请输入加：期初现金及现金等价物余额', trigger: 'change'  },
        //     {  validator: validateNum, trigger: 'change' }
        // ],
      },
      errorState:false,
      errorState1:false,
      errorState2:false,
      errorState3:false,
      id:'',
      totalNum:'',
      totalNum1:'',
      totalNum2:'',
      totalNum3:'',
      totalNum4:'',
      totalNum5:'',
      totalNum6:'',
      totalNum7:'',
      totalNum8:'',
      totalNum9:'',
      totalNum10:'',
      companyArr:[]
    }
  },
  watch: {
      information:{//深度监听，可监听到对象、数组的变化
        handler(val, oldVal){
          let info = this.information;
          if(info.rptDate){
              this.errorState = false
          }
          if(info.rptMaster){
              this.errorState1 = false
          }
          if(info.isCheck){
              this.errorState2 = false
          }
          if(info.currency){
              this.errorState3 = false
          }
          //经营活动现金流入小  
          let totalNum = {
              cashRecpSgAndRs:info.cashRecpSgAndRs,
              recpTaxRends:info.recpTaxRends,
              otherCashRecpRalOperAct:info.otherCashRecpRalOperAct
          }
          let num = 0;
          for (let i in totalNum) {
            if (!isNaN(totalNum[i])&&totalNum[i]) {
                   num+=Number(totalNum[i])
            }
          }
          this.totalNum = num;
          //经营活动现金流出小计：  
          let totalNum1 = {
              casPayGoodsPurchServRec:info.casPayGoodsPurchServRec,
              cashPayBehEmpl:info.cashPayBehEmpl,
              payAllTypTax:info.payAllTypTax,
              otherCashPayRalOperAct:info.otherCashPayRalOperAct
          }
          let num1 = 0;
          for (let i in totalNum1) {
            if (!isNaN(totalNum1[i])&&totalNum1[i]) {
                   num1+=Number(totalNum1[i])
            }
          }
          this.totalNum1 = num1;
          //经营活动现金流出小计  
          this.totalNum2 = num-num1
          //投资活动现金流入小计
          let totalNum3 = {
              cashRecpDispWithdrwlInvest:info.cashRecpDispWithdrwlInvest,
              cashRecpReturnInvest:info.cashRecpReturnInvest,
              netCashRecpDispFiolta:info.netCashRecpDispFiolta,
              netCashRecpDispSobu:info.netCashRecpDispSobu,
              otherCashRecpRalInvAct:info.otherCashRecpRalInvAct
          }
          let num3 = 0;
          for (let i in totalNum3) {
            if (!isNaN(totalNum3[i])&&totalNum3[i]) {
                   num3+=Number(totalNum3[i])
            }
          }
          this.totalNum3 = num3;
          //投资活动现金流出小计
          let totalNum4 = {
              cashPayAcqConstFiolta:info.cashPayAcqConstFiolta,
              cashPaidInvest:info.cashPaidInvest,
              netCashPayAquisSobu:info.netCashPayAquisSobu,
              otherCashPayRalInvAct:info.otherCashPayRalInvAct
          }
          let num4 = 0;
          for (let i in totalNum4) {
            if (!isNaN(totalNum4[i])&&totalNum4[i]) {
                   num4+=Number(totalNum4[i])
            }
          }
          this.totalNum4 = num4;
          //投资活动产生的现金流量净额
          this.totalNum5 =  num3-num4
          //筹资活动现金流入小计
          let totalNum6 = {
              cashRecpCapContrib:info.cashRecpCapContrib,
              cashRecpBorrow:info.cashRecpBorrow,
              procIssueBonds:info.procIssueBonds,
              otherCashRecpRalFncAct:info.otherCashRecpRalFncAct
          }
          let num6 = 0;
          for (let i in totalNum6) {
            if (!isNaN(totalNum6[i])&&totalNum6[i]) {
                   num6+=Number(totalNum6[i])
            }
          }
          this.totalNum6 = num6;
          //筹资活动现金流出小计
          let totalNum7 = {
              cashPrepayAmtBorr:info.cashPrepayAmtBorr,
              cashPayDistDpcpIntExp:info.cashPayDistDpcpIntExp,
              otherCashPayRalFncAct:info.otherCashPayRalFncAct
          }
          let num7 = 0;
          for (let i in totalNum7) {
            if (!isNaN(totalNum7[i])&&totalNum7[i]) {
                   num7+=Number(totalNum7[i])
            }
          }
          this.totalNum7 = num7;
          //投资活动产生的现金流量净额
          this.totalNum8 =  num6-num7 
          //投资活动产生的现金流量净额
          this.totalNum9 = this.totalNum8+this.totalNum5+this.totalNum2+Number(info.feeFxFluCash)
          //末现金及现金等价物余额
          this.totalNum10 = this.totalNum9+Number(info.cashCashEquBegPeriod)
        },
        deep:true
    },
  },
  created() {
      for (let i in this.information) {
            this.information[i] = '0'
        }
      this.information.rptDate = '';
      this.information.isCheck = '';
      this.information.currency = '';
      this.information.userId = '';
      this.information.id = '';
      this.information.attachmentId = ''
     this.id = this.$router.currentRoute.query.id;
      let sessionId = common.getCookie('sessionId');
      this.upLoadUrl =CONSTANT.URL.BASE.ADMINUPLOAD+ '?sessionId='+sessionId;
      this.getIndustry()
      this.getInfo()
      this.findCurrentCompany()
  },
  components: {
    "menu-top": () => import("../../common/Menu-Top"),
    "menu-left": () => import("../../common/Menu-Left"),
    "rotate-message": () => import("../../common/rotate-message")
  },
  methods:{
      findCurrentCompany(){
        let  url = CONSTANT.URL.SYSTEM.FINDCURRENTCOMPANY,
            data = {},
            dataForm = {}
            common.requestAjax(url,data,dataForm,(res)=>{
            if(res.status == 200){
               this.companyArr = res.data.bussData;
            }else{
            
            }
        })
    },
      formateMoney,
      getInfo(){
            let  url = CONSTANT.URL.WEB.FINDUSERBASEDETAILBYID,
                data = {},
                dataForm = {userId:this.userId?this.userId:null}
                common.requestAjax(url,JSON.stringify(data),dataForm,(res)=>{
                if(res.status == 200){
                    let info = res.data.bussData;
                    this.information.rptMaster= info.coreData&&info.coreData.companyName;
                    if(this.id){
                        this.getDetail()
                    }else{
                        this.information.associationId = this.$router.currentRoute.query.associationId
                    }
                }else{
                
                }
            })
        },
    linkTo(link,id){
        this.$router.push({path: link, query: {id: id}})
    },
    getDetail(){
        let url = CONSTANT.URL.SYSTEM.FINDCASHFLOWDETAIL,
            data = { },
            dataForm = {
                id:this.id
            }
            common.requestAjax(url,JSON.stringify(data),dataForm,(res)=>{
            if(res.status == 200){
                let data = res.data;
                this.information= data.bussData
                this.fileName = data.bussData.attachmentFile&&data.bussData.attachmentFile.fileName?data.bussData.attachmentFile.fileName:''
            }
        })
    },
    handleRemove(file, fileList) {      // 图片上传
        this.information.attachmentId = '';
    },       
    handleFileSuccess(res, file) {
            if(res.status == 200){
                let picItem = res.data.bussData;
                this.information.attachmentId = picItem.fileId;
                this.fileName = picItem.fileName;
            }
    },
    confrimBtn(formName){
        let info = this.information;
          if(!info.rptDate){
              this.errorState = true
              return;
          }
        //   if(!info.rptMaster){
        //       this.errorState1 = true
        //       return;
        //   }
          if(!info.isCheck){
              this.errorState2 = true
              return;
          }
          if(!info.currency){
              this.errorState3 = true
              return;
          }
        this.$refs[formName].validate((valid) => {
            if (valid) {
                for (let i in this.information) {
                    if(i!='attachmentId'&&i!='id'&&i!='userId'){
                        if(!this.information[i]){
                            this.information[i] = '0'
                        }
                    }
                }
                this.information.runInflowsCash = this.totalNum;
                this.information.runOutflowsCash = this.totalNum1;
                this.information.runNetFlows = this.totalNum2;
                this.information.investInflowsCash = this.totalNum3;
                this.information.investOutflowsCash = this.totalNum4;
                this.information.financingNetFlows = this.totalNum5;
                this.information.financingNetFlows = this.totalNum5;
                let url = CONSTANT.URL.SYSTEM.SAVEUSERFINANCECASHFLOW;
                let param = JSON.stringify(this.information);
                common.requestAjax(url, param, null, res => {
                    if(res.status == 200) {
                        this.$message({
                            type: 'success',
                            message: '保存成功!'
                        });
                         this.$router.push(`financialCashflow?userId=${this.information.associationId}`)
                    } else {
                        this.$message({
                            type: 'error',
                            message: res.msg
                        });
                    }
                });
            } else {
                return false;
            }
            });
    },
    getIndustry(){
        let  url = CONSTANT.URL.BASE.DICTIONARY,
            data = {},
            dataForm = {codeType:'currency'}
            common.requestAjax(url,JSON.stringify(data),dataForm,(res)=>{
            if(res.status == 200){
                this.giveArr= res.data.bussData
            }else{
            
            }
        })
    },
  }
};
</script>
<style lang="scss">

.operate-edit{
    padding-bottom: 60px;
    margin-top: 30px;
    .el-form-item{
        margin-bottom: 0;
    }
    .balance-head{
         padding-top:30px;
         padding-left: 30px;
         background-color: #fff;
        .balance-title{
            font-size: 16px;
            color: #ED7018;
        }
        .balance-search{
            margin-top: 22px;
            overflow: hidden;
            .balance-item{
                position: relative;
                height: 40px;
                line-height: 40px;
                font-size: 14px;
                color: #111;
                float: left;
                margin-right: 25px;
                margin-bottom: 30px;
                .error-tip{
                    position: absolute;
                    bottom: -74%;
                    left: 31%;
                    color: #f56c6c;
                    font-size: 12px;
                }
                .el-date-editor{
                    width: 165px;
                }
                .el-input{
                    width: 165px;
                }
                .el-select{
                    width: 145px;
                }
                .upload-demo{
                    display: inline-block;
                    .btn{   
                            display: inline-block;
                            width: 80px;
                            height: 30px;
                            margin-left: 0px;
                            background-color: #ED7018;
                            border-radius: 4px;
                            -webkit-border-radius: 4px;
                            font-size: 14px;
                            color: #fff;
                            text-align: center;
                            line-height: 30px;
                            margin-right: 0px;
                            cursor: pointer;
                            &:hover{
                                background-color: #ED9000;
                                transition:all .2s linear
                            } 
                        }
                }
            }
        }
    }
    .balance-wrap{
        background-color: #fff;
        padding-top:30px;
        padding-left: 30px;
        margin-top: 20px;
        overflow: hidden;
        .el-form{
            overflow: hidden;
        }
        .el-form-item__error{
            top: 67%;
            left: 44%;
        }
        .btns-bottom{
            overflow: hidden;
             margin-left: 30%;
             padding-bottom: 60px;
             margin-top: 40px;
            .btn{
                float: left;
                width: 126px;
                height: 40px;
                margin-left: 0px;
                background-color: #ED7018;
                border-radius: 4px;
                -webkit-border-radius: 4px;
                font-size: 14px;
                color: #fff;
                text-align: center;
                line-height: 40px;
                margin-right: 0px;
                cursor: pointer;
                &:hover{
                    background-color: #ED9000;
                    transition:all .2s linear
                } 
            }
            .btn-cancel{
                float: left;
                width: 126px;
                height: 40px;
                margin-left: 0px;
                background-color: #fff;
                border: 1px solid #999;
                border-radius: 4px;
                -webkit-border-radius: 4px;
                font-size: 14px;
                color: #fff;
                text-align: center;
                line-height: 40px;
                margin-right: 0px;
                cursor: pointer;
                color: #000;
                margin-left: 61px;
            }
        }
        .balance-line{
            width: 70%;
            float: left;
        }
        .balance-title{
            span{
                font-size: 16px;
                color: #ED7018;
            }
            .tip{
                font-size: 16px;
                color: #ED7018;
            }
        }
        .balance-item{
            font-size: 14px;
            color: #111;
            margin-bottom: 20px;
            
            span{
                display: inline-block;
                width:44%;
                text-align: right;
            }
            .tip{
                display: inline-block;
                width: 55%;
            }
        }
    }
}

a {
  color: inherit;
}

.main-content {
  background-color: #f5f5f5;
}

.breadcrumb-wrapper {
  margin-top: 29px;
}

main {
  position: relative;
  margin-top: 30px;
  background-color: #fff;
  padding-left: 37px;
  padding-top: 29px;
}

.tab {
  display: flex;
  height: 28px;
  padding-bottom: 18px;
}

.btn-group {
  position: absolute;
  right: 158px;
  top: 18px;
  display: flex;
  justify-content: flex-end;
  z-index: 999;
}

.btn-group>.btn {
  margin-left: 50px;
  height: 40px;
  width: 100px;
  color: #ffffff;
  border-radius: 6px;
  font-size: 18px;
  line-height: 42px;
  text-align: center;
  font-weight: 400;
}

.btn-group>.btn:first-child {
  background-color: rgb(225, 132, 73);
}

.btn-group>.btn:last-child {
  background-color: rgb(44, 53, 65);
}

.tab-item {
  position: relative;
  height: 17px;
  line-height: 17px;
  font-size: 17px;
  margin-right: 29px;
  font-weight: 500;
}

.tab-item.active {
  color: rgb(225, 132, 73);
}

.tab-item.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  bottom: -11px;
  background-color: rgb(225, 132, 73);
}

.view {
  background-color: #ffffff;
  padding-left: 35px;
  padding-bottom: 35px;
}
</style>
